Tesla Coil That Dances With Your Music - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Programs (https://staging.qb64phoenix.com/forumdisplay.php?fid=7) +---- Thread: Tesla Coil That Dances With Your Music (/showthread.php?tid=838) Pages:
1
2
|
RE: Tesla Coil That Dances With Your Music - SierraKen - 09-02-2022 Thanks guys! To run it in other systems other than windows, try removing the following code up on top, and also where it says you can see the file list in Notepad if you just press Enter. You will have to know the song filename. Code: (Select All) If file$ = "" Then RE: Tesla Coil That Dances With Your Music - SierraKen - 09-02-2022 Here is a picture of the Tesla Coil in action. I'm going to make a YouTube of it in action because photos don't do it justice. I'll use one of the computer songs I made many years ago so I won't have copyright problems on YouTube. RE: Tesla Coil That Dances With Your Music - SierraKen - 09-02-2022 Here is a 25 minute video I just made and uploaded using music I made around 15 years ago on this Tesla Coil simulation. You don't have to watch it all of course but I thought I would put the whole thing on there because it goes together well. After you click the video, wait about 1 or 2 minutes to let the program load the large song file first. https://www.youtube.com/watch?v=9FACSukS694 RE: Tesla Coil That Dances With Your Music - SMcNeill - 09-05-2022 A couple of people have reported that this isn't working in the new version 3.1 in QB64-PE. As I explained there, the glitch is two-fold: First, the old version of QB64-PE was glitched. The OpenAL backend *always* converted things down to mono-sound, so this program was always running under the 'integer mono TYPE 0 block of the IF statement in it. The new audio backend doesn't have that glitch (we fixed it), and now you get your stereo sound and such to play, whereas it never did before! YAY!! Second, this program has a slight glitch in how it checks against the mem.TYPE values. Here, it checks to see if the mem.TYPE = 1 or if the mem.TYPE = 4. Code: (Select All) If (sz = 4 Or sz = 2) And SampleData.TYPE = 1 Then ' integer stereo or mono This isn't what the values actually are. MEM values are built upon the various parts of the flags which make up the type which the mem block contains. For example, if the data length is 4 bytes, then it sets the 3rd bit to TRUE. (which &B100 has a value of 4) Now, if this data is an INTEGER TYPE, then it sets bit 7 to TRUE. (which &B1000000 has a value of 128) If the data is a FLOATING POINT TYPE, then it sets bit 8 to TRUE. (and &B10000000 has a value of 256) So, if our data type is a LONG, it'd have a value of 132. (bit 3 set and bit 7 set, making it an integer type which takes uses 4 bytes of memory) If the data type was a SINLGE, it'd have a value of 260. (bit 3 set and bit 8 set, making it a floating point type which uses 4 bytes of memory So the values you're looking for here isn't EQUAL 1 or EQUAL 4 -- they're AND 128 (integer type) or AND 256 (floating point type)... Code: (Select All) If (sz = 4 Or sz = 2) And (SampleData.TYPE AND 128) Then ' integer stereo or mono It's a minor glitch in the code which was never triggered or found because the old audio backend was glitched itself and only ever produced a TYPE 0 response. To work properly with the new backend, and to have stereo sound playing and all, these checks need to be ANDed instead of EQUALed. RE: Tesla Coil That Dances With Your Music - SierraKen - 09-05-2022 Thanks Steve. I changed the lines you talked about. I still don't know hardly anything about this, but if there is anything else I should change, please tell me. You also might want to update the Wiki page where I found this example code at, which is here: https://qb64phoenix.com/qb64wiki/index.php/MEMSOUND Here is the update: Code: (Select All) 'Tesla Coil by SierraKen - September 1, 2022. |