jFugue Saving MIDI Files While Still Including Loaded Instruments - jfugue

I am using an external soundfont to play MusicStrings and everything is working find. When I use player.saveMidi(etc, etc) the files are saved with the original MIDI soundfont.
Soundbank soundbank = MidiSystem.getSoundbank(new File("SGM-V2.01.sf2"));
Synthesizer synth = MidiSystem.getSynthesizer();
synth.open();
synth.loadAllInstruments(soundbank);
Player player = new Player(synth);
Pattern pattern = new Pattern("C5majw C5majw C5majw");
player.play(pattern); // works fine with external soundbank
player.saveMidi(pattern, filename); //Doesn't save with external soundbank instruments
Is there any workaround or built in feature that supports this functionality?
Thanks!

Keep in mind that MIDI is a set of musical instructions. Regardless of whether you load a soundbank into the Java program, when you save as MIDI, you're only saving musical instructions. (By "musical instructions", I mean things like "NOTE ON" or "INSTRUMENT CHANGE" but not actual musical sound data)
It sounds like what you want to do is render your music into a WAV file using the sounds from the soundbank that you have loaded. To do this, you'll want to use the Midi2WavRenderer available here: http://www.jfugue.org/code/Midi2WavRenderer.java

Related

How do I decompress a .astc file with an additional .ccz extension? How do I view .ita files?

First, full disclosure: I'm very new to coding and very new to file dissecting, but its something I anticipate studying in school very soon, so please pardon my ignorance in future interactions.
As a project I've decided to dissect the files of a mobile app I greatly enjoy. This app is Futurama: Worlds of Tomorrow. I'm a big fan of the cartoon, even spent money on the stuff, so I figured it was natural for me to pick.
Extracting the .apk file was easy, I found some of the assets they use in the game, like the music, the soundbytes, and some .pngs. All simple stuff.
However there are two files I'm absolutely baffled by: files with an .astc.czz extension and an .ita file that is not an italian read me file, the developers informed me that those are animation files.
Allow me to go into what I know and what I don't know:
Filename.astc.czz
Example file here
I recognize .astc as a compression file and was informed that .astc files are common for mobile games. Fair enough, but the real extension is .czz, the "real" extension of the file leads me to dead end. I've found the ASTC Evaluation Codec
by ARM-Software on github so I tried that. I changed the extension to .astc and then tried keeping .czz but the codec gives me an error every time. This is where I show my ignorance, I didn't know the right way to do this so I'm showing you every combination of what I tried. I replaced my name with user.
C:\Users\user\Downloads\astc-encoder-master\Binary\Win32
λ astcenc -d C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.astc C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.tga
File C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.astc not recognized
C:\Users\user\Downloads\astc-encoder-master\Binary\Win32
λ astcenc -d AC0001-dialogue1-003#2x.astc AC0001-dialogue1-003#2x.tga
File AC0001-dialogue1-003#2x.astc not recognized
C:\Users\user\Downloads\astc-encoder-master\Binary\Win32
λ astcenc -d C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.astc.czz C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.tga
Failed to open file C:\Users\user\Downloads\astc-encoder-master\Binary\Win32\AC0001-dialogue1-003#2x.astc.czz
C:\Users\user\Downloads\astc-encoder-master\Binary\Win32
λ astcenc -d AC0001-dialogue1-003#2x.astc.czz AC0001-dialogue1-003#2x.tga
Failed to open file AC0001-dialogue1-003#2x.astc.czz
No success there.
So then I learned that .CZZ files are apparently associated with visECAD Viewer and I downloaded that and the .astc.czz files became associated with the program. I tried opening them but visECAD says it cant open them because they are "outdated." So that's another dead end.
Right, so that's all I know.
Filename.ita
Example file here
Out of curiosity I've actually emailed the developers about this file (and the astc ones too) and they said those are the animation of the game. They couldn't send me a viewer, which is perfectly fine, but I don't even know what .ita files are associated with that aren't italian read me's. Any insight would be appreciated, the animations are great and I would love to see them.
For full disclosure here are snippets of what the developers sent me:
Those strange file types are actually compressed files (like
".astc.ccz"). Different devices use different compression methods, so
we support many types to maintain low storage and memory usage. Some
devices don't use compression and just use .png versions of the same
file names.
The .lta files are the game's animations. I wish I could help you out
with viewing them, but there's no way for me to send you a viewer. :(
Well that's all folks, sorry it was so long, and thank you so much in advance. I'm grateful already!
I realise this is a few months old, but in case you're still interested, I've just cracked it. Basically, it's a compressed texture, the ccz part being the compression, and the astc being the texture format. I managed to decompress the file using QuickBMS (http://aluigi.altervista.org/quickbms.htm), using the following script for ccz files (copy the following into a txt file):
endian big
comtype zlib_dynamic
get ZSIZE asize
math ZSIZE - 0x10
get NAME basename
idstring "\x43\x43\x5a\x21"
goto 0xc
get SIZE long
clog NAME 0x10 ZSIZE SIZE
On running QuickBMS, it will first ask for a script, upon which point it to your new txt file. Then it will ask for the file you want to decompress, point it at your ccz file. Then it will ask where you want to save your astc file.
Now you will need a program that can open astc files! I used this one, Noesis: http://www.richwhitehouse.com/index.php?content=inc_projects.php&showproject=91
Find your astc file (the interface is quite straightforward), then from there you can double click the file to open it, then right-click and export to a variety of formats. For proof of concept, here is the extracted pf0001-action5-001#4xout (PF being Philip Fry I assume). https://www.dropbox.com/s/t2l3mesi2psbd1p/pf0001-action5-001%404xout.png?dl=0
Both programs allow for batch processing as well, so you should have everything you need! However, the lta files are skeletal animation I believe, so unfortunately the character animations are all in pieces. However, I'm looking into that next. Hope this helps!
EDIT: The above information is useful for your specific query, i.e. decompressing and reading the contents of those files. HOWEVER, if your end goal is to view the assets of the game, it's worth knowing that many of the assets are only downloaded AFTER the game is run, so looking in the "com.tinyco.futurama" on your Android voice will show all kinds of assets not present in the apk file. Many of them will be ready-extracted as well, being made ready for gameplay, so I would highly recommend copying the contents of this folder periodically. I think it re-compresses unused assets as well, so I would copy out the ccz files also, then either way you should reap the maximum benefits.

wav sound is different on a public drive

I have a macro that plays a wav file. The sound is a "click" and it is played 5 times in a loop. Below is the line of code that is used to play the wav file:
sndPlaySound32 "C:\Temp\Click2.wav", SND_SYNC
sndPlaySound32 "W:\Users\Game\Click2.wav", SND_SYNC
When the wav file is stored on my hard drive, it sounds like the "click" I expect to hear. When it is stored on the public "W" drive, it is a Windows "ding".
Why does the file sound differently when it is on a different drive? Is there setting I can change to avoid the Windows "ding".
Thanks for the help.....
Check your filename and filepath, my guess is that the file wasn't found and you're hearing the default. From the documentation:
If the specified sound cannot be found, sndPlaySound plays the system
default sound. If there is no system default entry in the registry or
WIN.INI file, or if the default sound cannot be found, the function
makes no sound and returns FALSE.
If you want to disable this behavior, pass the SND_NODEFAULT flag:
sndPlaySound32 "C:\Temp\Click2.wav", (SND_SYNC Or SND_NODEFAULT)

Mac Matlab/ Simulinks Real time audio input

I am building a simple real time delay system on my mac (2010-11 model; os x Mavericks; serial audio input) using Simulinks (Matlab 2014a) consisting of a 'Audio Input' block, an 'Audio Output' block a 'delay' block and an adder (to add the delayed signal to the original signal), but I receive the error: 'Error in 'untitled/From Audio Device': A given audio device may only be opened once.' twice for the audio input block.
When I try the same using a audio file as my input I get the desired results. Also the same diagram works fine on a windows machine.
Please help.
Thank you.
I think the issue is that you are trying to output a sound to the audio device, while at the same time to trying to read from the audio device. That won't work, you can't do that. See Keep playing a sound over and over again in Matlab? for a similar issue in MATLAB. You need to somehow wait for the reading part to complete before outputting the sound back to the audio device, or use two different devices, one for reading and one for writing.
I suspect the same model worked on a Windows machine because it probably had two audio devices (maybe a built-in and an external), and the model automatically detected this, reading from one device, and outputting to the other. The documentation for both blocks says:
Use the Device parameter to specify the device from which to acquire
audio. This parameter is automatically populated based on the audio
devices installed on your system.
which again, reinforces that theory. If you still have access to the Windows machine, you can double-check that this is the case.

XNA WP7 - Open file without reading it all into memory?

I'd like to be able to open a file on Windows Phone 7, in an XNA game, without reading the entire file into memory. I'm trying to stream audio from WAV files, to be passed to DynamicSoundEffectInstance for playback.
The method I have now uses TitleContainer.OpenStream() to open the WAV file, and then reads it on a background thread using ThreadPool.QueueUserWorkItem(). However, this causes a hitch at the beginning, and today I verified that TitleContainer.OpenStream() returns a MS.Internal.InternalMemoryStream object, which would suggest that it's reading the entire file into memory in OpenStream().
This is corroborated by the fact that it seems to take effectively no time (or, only a memcpy()'s worth of time) to do the Read(), and that Stream.BeginRead() (which is included on WP7 as part of the Async CTP) calls its callback before returning.
Is there any way to open a file on WP7 XNA without reading the entire thing into memory? If not, this is completely ridiculous.
There does not appear to be a way to do this. However, since I know the size of the chunks I want to read (32kB), I can split the files into chunks offline and read them one chunk at a time.

Is it possible to programmatically push files to a wireless SD card?

Is it possible to programmatically push files to a wireless SD card - like a www.eye.fi card?
I use a Mac and thought I could do this using some AppleScript - but have not found a way...
Derek
The eye-fi card relies on image files being written to a specific directory in the card before they'll transfer them. Beyond that it works exactly like a memory card.
Write a file to it as if you're writing a regular memory card, and as long as it's a jpg image file of reasonable size, and in an appropriate directory (something under \DCIM\ probably) and they should transfer.
If you're having trouble, double check that it works with your camera, and find out where your camera puts the images on the card, and duplicate that. You might even try naming them similar names to the types of images your camera produces.
-Adam
It looks like you can treat it just like an external hard drive (plug the memory card in and figure out where the mount point is).
I think he wants to send files to it while its in another device, not plug it in and use it to transmit files like an antena directly connected to the machine.

Resources