Raul wrote: > Still... possibly of interest to some people here? Yes, definitely. I remember playing with Oleg's media/wav -but too long ago to recall much ambient detail. I regretted its lack of Mac support, though.
Mathematica has long had the ability to play any line graph it can generate as an audio waveform. They tout the feature as a useful tool in the pure mathematician's armoury. It's a bit like chemists sniffing or tasting their reagents. Offhand I recall the Riemann Zeta function having an eerie spacey sound, like a musical circular saw. Taking the Mathematica people at their word suggests that ~addons/graphics/plot ought to have the ability to generate wav, ogg, mp3, aiff or indeed any of the portable audio formats from a line graph, just as it can output it in visual form to pdf, png, etc. A decent interface with Audacity would be good too. Audacity I particularly recommend. ( http://www.audacityteam.org/download/ ) It's a general-purpose waveform editor you'd spend a long time replicating in J, but soon feel the need for. I've even heard of it being used as a logic analyser for circuit-design. Of all the DAWs (Digital Audo Workstations) it's the most flexible and internally accessible, and a lot of 3rd parties have contributed fancy add-ons. Audacity is freeware; most other DAWs decidedly aren't. I'd recommend generating standard audio formats from the word go, rather than reinvent the wheel by working with PlaySound applied to raw J number lists, as Oleg does. But it's quite on-the-cards you'll cook up a rare sound with J that would repay importing into Audacity, Ableton LIVE, Logic Pro <http://www.audacityteam.org/download/> or even GarageBand to give it a drum accompaniment or a vocal track. All these can import most of the audio formats you meet with, the cross-platform bog standard being mp3 (or used to be). In contrast, going down Oleg's route, you'd slave away for a year and eventually reinvent Audacity. On Mon, 26 Apr 2021 at 23:56, Raul Miller <[email protected]> wrote: > I've been playing around a little with Oleg Kobchenko's media/wav > > In its current implementation, it relys on > > https://docs.microsoft.com/en-us/windows/win32/multimedia/the-playsound-function > which means that it does not adequately support osx nor linux > machines. Finding and supporting equivalent mechanisms there would be > interesting. > > But, anyways, here's a brief introduction: > > load'media/wav' > lq=: [: <. 0.5 + 255 * ] > normalize=: (% >./)@(- <./) > 4 wavplay wavmake lq normalize 1 o. 2p1*440*normalize i.11000 > > This will play one second of 440 Hz -- > https://en.wikipedia.org/wiki/A_(musical_note) > > The default sample rate used by this playback mechanism is 11000 > samples per second. > > The normalize verb transforms a numeric list so that its minimum value > is 0 and its maximum value is 1. > > The lq verb translates a 0..1 floating point or fractional list to a > 0..255 numeric list. And, 4 wavplay wavmake on the result of lq sends > the sequence as an audio sample to be played by the computer's sound > system. > > If I wanted to be a little fancier, I might also want to disable a > potential ending "click" that can arise when a sound sample ends with > a non-neutral voltage value and no corresponding sound sample follows > it. And, maybe while I am at that, I should make it so that repeated > applications of lq perform its transformation only once. > > softend=: , 2#{: (+ * * i.@|) 128 - {: > lqsoft=: softend@lq^:(1 >: >./) > > Now I can throw in a one second "envelope" on my note > > A=: normalize 1 o. 2p1*440*normalize i.11000 > envelope=: normalize (* ^@-) 15*normalize i.11000 > play=: 4 wavplay wavmake > > play lqsoft envelope*A > > There's a lot more that can be done here -- assembling and scheduling > different notes, introducing beats and resonances, etc. etc. I've > barely scratched the surface of what can be done. And, of course, > different machines will introduce their own quirks, and we each have > our own various ideas of what sounds good. > > Still... possibly of interest to some people here? > > Thanks, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
