It is currently Mon Dec 18, 2017 1:12 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Jun 22, 2015 2:18 pm 
Offline
Formerly AlienX
User avatar

Joined: Fri Apr 18, 2014 7:41 am
Posts: 137
Location: Bulgaria
This should've been a part of the "About FCEUX's sound" thread, I made a year ago, but it's long dead, so I made another one, specifically for this question.
Is it possible to play different waveforms in FCEUX using Lua scripts? FCEUX basically uses specific algorithms to generate the different waveforms, the NES produces (particularly the ones, that the core 2A03 chip uses). So is it possible to recreate these algorithms with Lua scripts and then alter them a bit to create different sounds? For instance, at one point Channel 1 is playing a 25% Square wave. The code in the Lua script is sort of a counterpart of FCEUX's own sound script, so the script reads the data in the addresses for Channel 1 and it plays that channel, but instead of a pulse wave, it's playing a saw wave.
Sure, the sound may play separately from FCEUX's own audio, but that doesn't matter. If this is possible, without modifying FCEUX's code code, some interesting stuff can be created with that. Useless, but still interesting. And if Lua scripts allow for playing sound files, a sample based NES Audio system could be created.
This all seems a bit far-fetched, but it might be possible. Is it? I'd like to know.
Thanks.

_________________
Greetings! I'm That Bio Mechanical Dude and I like creating various stuff like movies, games and of course chiptunes!
You can check out my YouTube Channel.
You can also follow me on Twitter.


Top
 Profile  
 
PostPosted: Mon Jun 22, 2015 2:21 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
Correct me if I'm wrong, but I don't think the LUA embedded in FCEUX has any direct access to sound output.

Why exactly do you want to do it in LUA, anyway? It would be a lot easier just to modify FCEUX, I think.


Top
 Profile  
 
PostPosted: Mon Jun 22, 2015 4:08 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3969
Might be possible to inject timed writes into the RAW PCM channel, but that would be slow.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Tue Jun 23, 2015 7:50 am 
Offline
User avatar

Joined: Tue Apr 19, 2011 11:26 am
Posts: 106
Location: RU
Lua has read-only access to fceux sound. So if you really need, you may plug something to lua itself and use it to output your sound separately. You can't edit how it's generated in the core, and you're unlikely to ever be able to.

http://www.fceux.com/web/help/LuaFunctionsList.html


Top
 Profile  
 
PostPosted: Tue Jun 23, 2015 1:09 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3969
Lua also has "loadlib" for loading arbitrary DLL files.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Tue Jun 23, 2015 2:15 pm 
Offline
Formerly AlienX
User avatar

Joined: Fri Apr 18, 2014 7:41 am
Posts: 137
Location: Bulgaria
Well, as I said, the sound from the Lua script could play separately, meaning it won't modify FCEUX itself. I just want to know if it's possible to produce sounds with Lua Script. External program... that might work.
Why Lua? Because, if I wanted to just modify FCEUX, I'd have to spend a month or two, learning C++, then finding FCEUX's source code, picking out the sound-generating algorithm and finally modify it. I think it's much faster to use a scripting language, that probably doesn't take that long to get the hang of.

_________________
Greetings! I'm That Bio Mechanical Dude and I like creating various stuff like movies, games and of course chiptunes!
You can check out my YouTube Channel.
You can also follow me on Twitter.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group