fenomas/wasgen

.WAV export tuning/note duration/file duration not affecting output file

Closed this issue · 12 comments

Just a notification over here. I still use this beast of a synth to create tones for my music, and I'd like to be able to tune the output waveforms properly. Was in a hurry before, so I didn't mention this. Would it be possible for this small portion of the tool to be made operable on the user-side? Would save lotsa time!

Hi Kirk, sorry, saw this at first but then I couldn't find it again.

Let me look into this, I thought tuning and duration were working with the file export. Can you copy in a specific example of the kind of sound program you're exporting, and what values are in the three lower text fields (frequency/note duration/file duration) when you export?

Andy,
Absolutely!

Here's what I get on-screen as default:

[
{ type: 'sine',
freq: [
{ type: 'triangle',
gain: { t:3, a:0.01, h:0.01, d:0.7, s:0.1, r:0.05, k:-1.2 },
},
],
gain: { t:0.4, a:0.005, h:0.01, d:0.7, s:0 },
},
]

440 Frequency
0.5 Note duration (sec)
5 File duration (sec)

Since I use Renoise, they tune to C instead of A, so the sampler is looking for this:

261.63 Frequency
0.5 Note duration (sec)
5 File duration (sec)

I also have noticed that the note duration does not transmit either. So, I'll get a 5 second .WAV file, but it will have only a 0.5 second Note Duration, whether or not I change it to say, 3 seconds or not. The end result will still be a 0.5 second note length with a tuning of 440.

This happens with any particular sound.

Are you exporting with the defaults, or changing the values?

The intention here is, that when you hit "export" it should use whatever values are in the text boxes:

  • frequency becoming the input frequency to the sound program
  • note duration being how long the piano key is held down, as it were (i.e. the note decay starts after this duration)
  • file duration being the actual length of the exported wav (including decay at the end)

For convenience, when you hit keys on the keyboard the top two fields should change automatically - e.g. hitting j should play a tone at 277hz, and the note duration will get set to however long you held down the key. But if you change the numeric values those should get used for the file export.

Is that not what you're seeing?

I'm simply changing the numeric value of 'frequency', which is set at 440 to 261.63, to start. The exported .WAV file is still at 440. Just tried the keyboard method, though, and that works just fine - still not getting the tuning I'm typing in, but this is closer.

Screen Shot 2022-01-30 at 6 44 13 AM

Hmm, so the exported sound file is out of tune compared to the sound you hear from your browser when you hit the key? Internally they should be the same sound, so this might be some kind of browser issue. What OS/browser, and does the same thing happen if you change browsers?

  • When I use the keyboard method, the sound's frequency and length change, and the exported sound file is correct.
  • When I only adjust the frequency/note duration via the text fields (no keyboard), the sound file retains it's initial settings; in fact, it actually reverts back to 440 when I hit the "Play Sound" button, even after I change it :)

I'm on Mac OS X Monterey with the Google Chrome browser. I'll try this on Safari and report back quickly.

The issue remains the same in Safari.

Ahh, I see - so the sounds match if you demo the sound with keys, it's just the text field is being ignored... this must be a simple UI bug, let me dive in.

Separate request, could there also be access to MIDI channel 10 for drums? Beautiful OPL3 FM/PM drums are available on the test synth here: https://g200kg.github.io/webaudio-tinysynth/soundedit.html

Can you retry the sound export now? Hard-reload the demo page and check that it says v0.18.1 at the bottom, since github's hosting can take a few minutes to update.

Works!!! Heck yeah :D This is very useful for simulated timbral change on the release of notes in Renoise's sampler.

Ah cool! Yeah it was just a dumb UI bug.

On drum sounds, I don't follow - I thought all of the tinysynth presets are converted and in the demo, but if stuff is missing please file a new issue for it, thanks!