You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

Haskell Audio Synthesizer

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

0
b/PC, Mac & Vintage Computers publicado por u/unknownloner January 20, 2015, 06:56:03 AM
I decided I wanted to learn the ins and outs of how audio actually works, and figured I could get some more experience with Haskell at the same time.
Anyhow, here's some code
https://github.com/unknownloner/HaskellSynth

And some sample output (though it's pretty easy to modify it to play something else)


It's not exactly the most sophisticated synthesizer, but it's something, and is kinda neat to play with it.
I've got basic tones playing, but I want to create an Attack-Decay-Sustain-Release envelope so I can have proper notes. I also want to actually learn more about how sound works so I can create more interesting sounds, like some of the stuff you hear in more modern electronic music, because I still have no idea how :P
I also want to be able to read midi files, and handle the Note On/Note Off events to play an existing midi file.
Inicia sesión o crea una cuenta para dejar un comentario
u/Dream of Omnimaga January 20, 2015, 07:24:34 AM
Oooh, old school sound there :D. You should keep it non-sophisticated :P. What would be cool is if it could produce both 8 bit and 16 bit chiptunes (maybe like the Sega Genesis)

Also reading midi files would be awesome. GXSCC does that but the drums are bad.
u/unknownloner January 20, 2015, 02:59:02 PM
I might do some deeper research into the C64's SID and see if I can reproduce that sound, because I like what it can do.
u/Dream of Omnimaga January 21, 2015, 04:50:36 AM
Yeah it would be amazing indeed. :D
u/novenary January 21, 2015, 02:47:10 PM
Nice, a chiptunes synth. :D Looking forward to what you can do with it.
u/unknownloner January 22, 2015, 02:38:41 AM
Well I may not be the best at composition, but this sounds kinda neat

EDIT:
Low-pass filter stuff:
Last Edit: January 22, 2015, 04:02:12 AM by unknownloner
u/Dream of Omnimaga January 22, 2015, 04:17:59 AM
Ooh I like that first one. It would fit well for a space game intro. :) Also interesting effects with the 2nd file :D
u/unknownloner January 23, 2015, 02:53:02 AM
I keep using the same note sequences as I add more effects since I don't feel finding more, but it's a nice way to compare old vs new code
For example:
Here's a version of nightmare night from awhile ago when I just started:
Here's a new one with ADSR envelope (and some random values for it that I thought seemed alright):
The synths aren't the same though so the style is a bit different.

Also here's a new rainbow factory, again with ADSR envelope


My file names keep getting shorter and shorter.

By the way if anyone has any sequences that might be fun to test with, let me know. As long as it's got sheet music (or a straight up list of notes), and a looping section that isn't too long, I might mess with it. (hint hint DJ_O ;))

EDIT:
lol bass
Last Edit: January 23, 2015, 03:21:47 AM by unknownloner
u/Yuki January 23, 2015, 05:07:32 AM
Ooh nice stuff here.
u/Dream of Omnimaga January 24, 2015, 01:37:50 AM
Quote from: unknownloner on January 23, 2015, 02:53:02 AM
I keep using the same note sequences as I add more effects since I don't feel finding more, but it's a nice way to compare old vs new code
For example:
Here's a version of nightmare night from awhile ago when I just started:
Here's a new one with ADSR envelope (and some random values for it that I thought seemed alright):
The synths aren't the same though so the style is a bit different.

Also here's a new rainbow factory, again with ADSR envelope


My file names keep getting shorter and shorter.

By the way if anyone has any sequences that might be fun to test with, let me know. As long as it's got sheet music (or a straight up list of notes), and a looping section that isn't too long, I might mess with it. (hint hint DJ_O ;))

EDIT:
lol bass

Unfortunately, I use an emulator so I cannot export note sequences for my songs, not to mention Music 2000 doesn't display note names so I am not very familiar with them.

Anyway your new examples sound nice. With ADSR values, are you able to make notes fade out, by the way? I noticed that you mostly use fade-in.
u/unknownloner January 24, 2015, 01:38:48 AM
Yeah I can make them fade out.
u/Dream of Omnimaga January 24, 2015, 02:03:33 AM
Do you think some sort of reverb or echo like in some late NES games would be possible?
u/unknownloner January 24, 2015, 02:17:59 AM
Could you link some examples?
u/Dream of Omnimaga January 24, 2015, 02:29:11 AM


Another example, although it's not a song, but rather a sound effect, is in Journey to Silius title screen when you press Start. Also the intro music has some echo effect it seems.

Last Edit: January 24, 2015, 02:31:56 AM by DJ Omnimaga
u/unknownloner January 25, 2015, 08:45:27 AM
Not quite sure how this ended up working but kinda fun...


Sine wave with w/period of 0.9 * triangle wave w/period of 1.2 controlling notes

noteFor t = noteFreq (round (ctl t * 2) + 40)
    where ctl t = sineWave 0.9 t * triangleWave 1.2 t
Start a Discussion

b/PC, Mac & Vintage Computers

Computer programming discussion and project showcase

132
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal