Author Topic: Drum Machine Prototype  (Read 11075 times)

0 Members and 1 Guest are viewing this topic.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Drum Machine Prototype
« on: April 10, 2020, 07:36:39 pm »
Here's a drum machine, or beat maker.  I started making another puzzle game, but it turned into a little music making program instead.   With this you can make drum beats using 14 drum instrument samples.  This is just a prototype, and limited, with lots of room to grow, but it's a start at least.     

How to use the program is in the code.  Hoe you enjoy it.

- Dav

Note: Jump to latest version here:
https://www.qb64.org/forum/index.php?topic=2459.msg117923#msg117923

 
drummachine.jpg


 
« Last Edit: May 07, 2020, 07:35:59 pm by Dav »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Drum Machine Prototype
« Reply #1 on: April 10, 2020, 08:33:23 pm »
Here's what beginners luck sounds like :)

 
Beginners Luck.PNG

FellippeHeitor

  • Guest
Re: Drum Machine Prototype
« Reply #2 on: April 10, 2020, 09:35:00 pm »
This is SO much fun, Dav! I'm glad you're a musician besides being an awesome coder. Thanks for sharing!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Drum Machine Prototype
« Reply #3 on: April 10, 2020, 11:38:58 pm »
I am definitely NOT a musician but this is fun!  Well done!
Logic is the beginning of wisdom.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Drum Machine Prototype
« Reply #4 on: April 11, 2020, 09:16:25 am »
Thanks everyone.  I'm planning to add saving/loading, increase sound number, different drum kits, and a couple other improvements for the next version.

Somehow I need to remove the delay when a user clicks the button.  Will have to rewrite how I'm getting the mouse click. As it is now, you can pause it by holding down the mouse button.

- Dav

FellippeHeitor

  • Guest
Re: Drum Machine Prototype
« Reply #5 on: April 11, 2020, 09:55:42 am »
It would also be nice to be able to drag the mouse and keep adding or removing (drawing really).

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Drum Machine Prototype
« Reply #6 on: April 11, 2020, 10:10:53 am »
Amazing work! :D
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Drum Machine Prototype
« Reply #7 on: April 11, 2020, 11:28:50 am »
With Terry's piano and Davy's drums, all we need now is somebody to add guitar/bass, and we're all set to make our own music!  (Which, with my great musical talents, could only be used as a soundtrack for the cacophonous backdrop of a game set in the deepest layers of hell...)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Drum Machine Prototype
« Reply #8 on: April 11, 2020, 11:46:29 am »
Hi Dav

I have just tried it and I find it wonderful!
Music is fantastic, all the genres. 
take a look to the video and good hearing
https://www.youtube.com/watch?v=eSLFVYwGF0c
Programming isn't difficult, only it's  consuming time and coffee

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Drum Machine Prototype
« Reply #9 on: April 11, 2020, 03:33:15 pm »
Excellent work! It's very nicely done. There will be no problem with saving to WAV format, or you can make a much smaller music format designed specifically for QB64. I'm glad there is next person who solves music. I wish you patience in the further development. I haven't started my own editor yet, because my duties didn't allow it me.


Quote
With Terry's piano and Davy's drums, all we need now is somebody to add guitar/bass, and we're all set to make our own music!  (Which, with my great musical talents, could only be used as a soundtrack for the cacophonous backdrop of a game set in the deepest layers of hell...)

Steve, I know exactly what you're talking about. My song? Put the nails in the pan and throw it down the stairs. The following nois is a song from me.
« Last Edit: April 11, 2020, 03:38:05 pm by Petr »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Drum Machine Prototype
« Reply #10 on: April 11, 2020, 03:37:49 pm »
This is why we're lucky to have Dav around. A guy who marches to his own drum (machine.bas)
You're not done when it works, you're done when it's right.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Drum Machine Prototype
« Reply #11 on: April 11, 2020, 06:15:47 pm »
Cool... You've built in a Random Feature! Who would have guessed that you could pause by holding down the mouse button... Any more 'hidden treasures'?
Logic is the beginning of wisdom.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Drum Machine Prototype
« Reply #12 on: April 11, 2020, 08:07:22 pm »
This is great stuff, I'm finally able to get more cowbell when I need it.

P.S. A save feature would be really cool at this point. Oops I see it's already being contemplated. Never mind...
« Last Edit: April 11, 2020, 08:24:07 pm by OldMoses »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Drum Machine Prototype
« Reply #13 on: April 11, 2020, 10:57:37 pm »
Wow, I appreciate all the feedback!   Worked on it a little bit more today.  Added a drawing mode for Fillippe, also added a right click over the notes to quickly erase them. Added a crude pattern save/load (just one pattern for now) and the program will autoload the pattern on startup, if the file exists.  I'll post the updated version soon.

Here's what I have in mind for future versions... I'd like to use several sounds for each instrument during playback, and rotate playing them, so the sounds don't clip off when playing a new note (like the cymbal sound does currently) and it should sound more natural, especially when playing notes close together quickly.  I'd like to add pages to make longer patterns, and a Bass page to write/play a bass pattern while the drums play.  I'll have to re-write a lot to incorporate pages.  Also, a mute instrument option.  Currently assembling more sounds for more drum kits.  I need to re-arrange layout too to show everything, add put up clickable buttons for the options, add a help screen. 

Really impressive how well QB64 handles playing so many audio files at once.

- Dav
« Last Edit: April 11, 2020, 10:59:24 pm by Dav »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Drum Machine Prototype
« Reply #14 on: April 14, 2020, 09:25:25 pm »
Updated the DrumMachine.  Instead of posting a new BAS file I have to repackage it because I changed some data files.  Here's a new version.  I will leave the last version up for reference.  Here's what's new:

'New in v0.1b

Added: Added Two more intruments, Clave, Triangle
Added: Right click over squares to quickly erase them.
Added: Press "d" enters drawing mode, then ESC will exit drawing mode.
       When in drawing mode, playback stops.
Added: Simple file save/load of pattern, (s = save, l = load)
       Pattern saved as drummachine.sav in current directory.
       This file is auto-loaded on startup, if it exists.
Added: Double open/play longer playing sounds for more realstic sound,
       Instead of playing same sound for low/high vol, which often clipped,
       two file handles are used now, one plays high vol, one for low vol.
Added: Instrumet name images. I plan on them being clickable soon (to mute)
Added: Gave the program a TITLE bar name
Fixed: Show 1st marker position when doing a reset (enter) when paused.
Fixed: Stopped hhopen from playing when hhclosed starts, like it should.

Download v0.1b here -> 

- Dav
« Last Edit: April 14, 2020, 09:27:18 pm by Dav »