Fingercomp 37 Posted June 30, 2018 Share Posted June 30, 2018 The sound card is added by Computronics, a wonderful addon for OpenComputers. There are a few who actually know what it does. Even less people are able to use it. No one dares to understand how it works, or so I hope. Anyway, it appeared a few years (?) ago, and is still mostly undocumented. There is a page in the in-game manual, which fails to explain how great the card is. Of course it does! It has a heap of different methods, which you can use to cast many crazy magics to make the sound card sound, and it's impossible to teach someone to do magic by reading a single page. OK, I'm serious now. Last year I managed to understand how to use it, and even wrote a few posts about that. In Russian. Half a year later, I translated them to English. And now I thought of posting a topic here so that you could read them, too. Here's the link. The first two parts are all about basic things, like getting simple sounds, ADSR, and modulation. The third part features a little bit more complex things, like complex numbers and Fourier transforms. I tried to keep it simple, so I could get something wrong. If so, please leave a comment there pointing out the mistake. Grammar fixes are also highly appeciated. Izaya, Molinko, ben_mkiv and 1 other 4 Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted September 7, 2018 Share Posted September 7, 2018 i know you said to post comments on the github thread but (am too lazy to make a account also you'll see it faster here - i think) so the sound card can play wav files?! omg, thats amasing i'll try it out http://test.noahtg.com/theAlienIsStealingCows.mp4 all right yeah i can sell this as an alien sound efect http://test.noahtg.com/yayItworksKindof.mp4 omg this sounds like songs this time yay! altho it sounds like there is running a retro space movie from the 1970 in the background http://test.noahtg.com/andAliensAgain_SAD_.mp4 "and there goes a nother cow" -noahthegame 2018 sems the gymnopedie no.1 is a little too much for it the yayItWorksKindof is a melody from kong fu panda so perhaps its a wrong setting? i'm conferting the wavs from mp3 files altho they sound currectly on my irl music player thingy tho a simple answer chould be that the program/sound card just can't handle such adv. melodys? maybe? Quote Link to post Share on other sites
Fingercomp 37 Posted September 8, 2018 Author Share Posted September 8, 2018 The last chapter mentions briefly the biggest problems that make sound reconstructed from the audio data sound bad, and I'm going to try to explain them. 1. The program is quite simple. It's merely a proof of concept. It doesn't use modulation or non-sine waveforms. 2. Most sounds are complex. Most sounds I hear are far from being purely sinusoidal. Perhaps it's different for you, or for someone else who happens to read this post. :) White noise is vastly different from a flute, and the flute isn't the same as a guitar. Each instrument has a unique timbre, and even a single instrument can have different timbres depending how performers play it. Sound can be decomposed into an infinite number of sinusoids that, when summed together, produce the original sound. This is what Fourier transform does, basically. So if you use it to decompose a sound of a violin playing, and filter the output, you'll see, indeed, multiple sine waves that construct the signal, which are called partials. When you reconstruct the sound back, to get better approximation, you need to sum more partials. 3. Unfortunately, the sound card only has 8 channels (by default). This means that from the set of sinusoids that represent the encoded signal we have to choose eight of them. It's enough for a piano, but for some sounds (such as human speech) it's clearly too few of them, and what you get doesn't even seem to be similar to what was originally encoded. It's worth noting that if the program also analyzed the spectrum to use different waveforms, it could probably achieve a better resemblance. 4. Furthermore, we discard phase. The Fourier transform produces two values for each sinusoid: the amplitude, and the phase. The phase is important. For example, if you have two sine waves that differ in phase by π, and have the same frequency and amplitude, you won't hear any sound. These sinusoids are opposite of each other: if, at some point, one has a value of 0.5, the other has the value of -0.5, so, when you sum them, you get zero everywhere. The sound card has no way of setting phase. It's possible to get the situation as described above: if the first channel accumulates phase of π, and then you initialize the second channel, you may hear no sound at all! Though, given the limited channel count, the fact that we discard the phase doesn't really make much difference. But the channel count can be changed in the configuration file. When I was testing the program, I had tried running it with 64 channels. It was quite noisy, because the program does not filter the output of Fourier transform, and doesn't set phase. It was also glitchy, caused by my computer, which was unable to process everything fast enough. But it was still better than 8 channels. Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted September 8, 2018 Share Posted September 8, 2018 15 minutes ago, Fingercomp said: White noise is vastly different from a flute, and the flute isn't the same as a guitar. Each instrument has a unique timbre, and even a single instrument can have different timbres depending how performers play it. the 2# song that sounded got was exeraly a violin and it was a "fake" violin so to speak meaning that the music was made by a midi to mp3 arguritem. thats most likey why it sounds decent becuse it isn't as complicated then if a musision had played it 24 minutes ago, Fingercomp said: and what you get doesn't even seem to be similar to what was originally encoded. yeah you see the: 17 hours ago, Ta©ti Tac0Z said: http://test.noahtg.com/theAlienIsStealingCows.mp4 was first proccest by some pcm converter from the 1991 it made the song 3 times as long as it should so thats broken thats why it played score.pcm not score.wav as in the secount actemnt. i used time seaching for a pcm converter becuse i miss inderstond what you said in your github thread the: 17 hours ago, Ta©ti Tac0Z said: http://test.noahtg.com/yayItworksKindof.mp4 was the one who worked it was what i said a file who was: midi then mp3 then finaly a wav with the qulaty set to 8000 hz insted of 24000 hz the last one: 17 hours ago, Ta©ti Tac0Z said: http://test.noahtg.com/andAliensAgain_SAD_.mp4 is the one who started sounding bad its a "fake" piano melody (also midi) but belive it or not but i can hear a little of the song in 0:04. anyway so you say that there is not enough sinusoids (channels) to form the sound and that we can't just add infined about of channels at some point the computer whould be too slow or comutronics whould get enough and start playing wriedly or what you said: 42 minutes ago, Fingercomp said: It was quite noisy, because the program does not filter the output of Fourier transform so there is programs that can make some thing called midi-piano and that is a much more simpere then actuel piano so if i feeded that in your program whould that make any positive resoluts? Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted September 8, 2018 Share Posted September 8, 2018 do you know if some body as made a table or at least a list of all (or at least some) piano notes by fregensy? becuse i don't want to go like notes = { {"#A1", some-freg}, {"A1", some-freg}, ... --EDIT: this will most liky be better: notes = { "#A1" = some-freg, "A1" = some-freg ... thats gona take forever Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted September 8, 2018 Share Posted September 8, 2018 1 hour ago, Ta©ti Tac0Z said: so there is programs that can make some thing called midi-piano and that is a much more simpere then actuel piano so if i feeded that in your program whould that make any positive resoluts? forget it i hoped there was like a single wave mode Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted September 9, 2018 Share Posted September 9, 2018 22 hours ago, Ta©ti Tac0Z said: do you know if some body as made a table or at least a list of all (or at least some) piano notes by fregensy? becuse i don't want to go like notes = { {"#A1", some-freg}, {"A1", some-freg}, ... --EDIT: this will most liky be better: notes = { "#A1" = some-freg, "A1" = some-freg ... thats gona take forever i found out my self i made a javascript that will create a lua table form a html table: http://packages.noahtg.com/pianoNotesArray.php Quote Link to post Share on other sites
Rahph 1 Posted October 26, 2018 Share Posted October 26, 2018 On 9/7/2018 at 10:10 PM, Ta©ti Tac0Z said: i'll try it out http://test.noahtg.com/theAlienIsStealingCows.mp4 all right yeah i can sell this as an alien sound efect What was the original track called? Quote Link to post Share on other sites
Ta©ti Tac0Z 2 Posted October 26, 2018 Share Posted October 26, 2018 I belive it is from gymnopéde no. 1 if thats what You mean? Quote Link to post Share on other sites