Swift NSPasteboard to copy an audio (.wav) file to clipboard - swift

I've been pulling my hair out trying to find any resources on to do thi. It seems to be possible according to the documentation. But nothing I try works. I only need to copy the audio to the clipboard, the application I'm writing requires that the user manually switch to a different application to paste the audio in at specific locations. Copy & pasting text is easy of course, but audio I just cant seem to figure out. The files would be stored locally on the desktop/documents/etc.
Any help here would be greatly appreciated.
Running Swift 4 & 5

Related

What is the ID of the 'MessageReceived' sound on macOS?

I'm trying to use the 'ReceivedMessage' sound on macOS using AudioServicesPlaySystemSound() but I can't seem to find the ID anywhere.
What I've tried:
I've looked under /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds and couldn't find it either - although MessageSent is there.
I've tried AudioServicesPlaySystemSound(1003) as well following this link but that just results in silence. Any help would be greatly appreciated!
I've tried looking in Messages > Show Package Contents which only led to more disappointment.
I found the file here but I was a hoping to just link to it directly rather than including the .caf file in my app bundle.

Download Result of Source Destination (Web Audio API)

I'm building a tool to edit audio with the Web Audio API.
Here is where I'm stuck:
...
source
.connect(gainNode)
.connect(analyser)
.connect(analyser2)
.connect(audioCtx.destination);
};
What I've written (which ends with the code above) successfully allows the user to upload a file, apply effects, and listen to it on play(). How would I then allow the user to click a button to export the results to a WAV file?
I've tried several methods online that have not worked for my use case.
Please let me know if more code is needed. Thank you for taking a look!
If you want a WAV file, I think you have to do that yourself. WAV files are quite simple. In this case, you'll need to add either a ScriptProcessorNode or AudioWorkletNode just before the destination to capture all the audio and convert it to a WAV file that can be downloaded.
If a compressed file is ok, you can look into MediaRecorder to save the data for you.
I ended up solving this by writing an entirely different script to download the file using OfflineAudioContext.
My original script plays the audio with effects, and the second script downloads it with the same effects. Now to figure out why there is latency on the effects while using OfflineAudioContext.

.des files not opening in xcode

I have a problem that i want to open and edit some images of .png extension that are currently in .des extension (for example button_start.png is in the form button_start.des) when i open button_start.des in the xcode it just show a text file like this(button_start.png 12234.00132330122309.that is now of image along with a long numerical number or possibly a hash code) i had been trying to open this .des file with many softwares like coreldraw and quickbooks but it still dont open.It had been weeks but still i am not finding any solution.please guys help me to solve this problem. thanks
.des-files are 3D-project-files. Xcode can't read nor see them, so you need to open them in the application they were created in and export them as PNGs.
If you added the .des-ending manually to a .png-file, you could simply rename the file file.png and it will work.

Record audio, add effects, then save result to a audio file

I am having trouble doing what the title said. My goal is to be able to add any desired effects to your recording, save the modified audio, then send that to a server.
I have searched the fourms and came across these threads:
viewtopic.php?f=7&t=13029&p=45362&hilit=saving#p45362
viewtopic.php?f=7&t=12660&p=44586&hilit=saving#p44586
viewtopic.php?f=7&t=13178&p=45746&hilit=saving#p45746
After reading those, I see it is possible to save the modified audio, but can it only be saved as a wav? Like I said after it is saved it will be sent to a server, so size is a big deal and wavs are relatively big compared to other formats. Ignoring that fact, I tried to implement FMOD_OUTPUTTYPE_WAVWRITER and I cannot get that to work; are there any good examples of using it? I looked though the examples in the library but I didn't see any..
But the basic structure of the app is to record, turn some switches off and on to see what filters you want, preview it, then press a button "Save" that will save it. What would this save function consist of?
Any help appreciated, thanks.
Using FMOD_OUTPUTTYPE_WAVWRITER is fairly straight forward, you set the type via System::setOutput, specify the output file via System::init extradriverdata. The extradriverdata should be an absolute path to a writable area of the device such as the documents directory. After you have finished playing, call System::release and the file will be complete.
The other option for recording wave data with effects is by creating a custom DSP and connecting it to the channel playing the recorded data. You will then get regular callbacks giving you float data that you must write out to disk yourself. You can find examples of DSPs and writing wav files in the dsp_custom and recordtodisk examples respectively.
Finally note that FMOD doesn't come with the facility to write compressed audio to disk, you will need another API to achieve this goal.
You can save as an AAC file via the ExtAudioFile API.

The best resources file type for iPhone

In my iPhone project, there are a lot of files including: image files, audio files, and text files.
Now the issue is finding the best file type to manage these files. The image files are related with the audio files and the text files.
I need a file that show the relationship of these files.I am currently using txt type, but it seems chaotic. I want to use xls file type but I can't parse the file correctly.
Can anyone help me? Thanks.
Try using a PLIST. They are easy to read (NSDictionary and NSArray can be created from them) and allow associations to be stored. Also, XCode provides native editing support.