MIDI to MP3 from terminal: Accessing channel volume - bash

I'm writing a bash script that will be used to go through a ton of midi files and convert them into MP3s. Right now, I'm using timidity and lame for this, which works great:
timidity myMidiFile.midi -Ow -o - | lame - audioOutput.mp3"
However, I would like to have access to the different midi channels so that I can choose to lower or raise the volume on them individually. I've been looking through the timidity manual without really finding any solution.
Can this be done via timidity or do I have to transition to some other program?

Related

Dumped video stream often not readable in VLC

I have two IP Cameras, and I'm regularly collecting the dumped video stream in a file. Every 30 minutes I kill down the running processes, and restart dumping, using the "mplayer" command in background to generate a .mp4 file.
Basically I'm running something like this:
killall mplayer
mplayer -dumpstream rtsp://cam01:554/video.mp4 -dumpfile cam01.mp4 & bg
mplayer -dumpstream rtsp://cam02:554/video.mp4 -dumpfile cam02.mp4 & bg
Then I store all the resulting .mp4 files for future checks.
Now there is the problem: many files are perfectly readable (using VLC) and many files aren't (I'm just able to open "unreadable" files using the "ffplay" utility).
However, as I'm using a VLC app in a smart TV to open them, I'd like to be able to open all files in VLC. Could you please give me some advice?

using output template error via youtube-dl

I admit, I'm new to Linux, but I pieced together the following in the Ubuntu terminal to download all of the videos from a YouTube channel:
youtube-dl -o "/media/ubuntu/3A3A9F353A9EED5F/%(uploader)s/%(autonumber)s.%(title)s.%(ext)s" --download-archive ~/.mydownloads -citw ytuser:DirectFix
However, I keep getting this error:
youtube-dl: error: using output template conflicts with using title, video ID or auto number
What do I need to do so I can download the files straight to a separate internal drive, rename the files, and keep track of the videos I've already downloaded?
Your options -citw do not make any sense. Simply remove them (maybe leave -i) and the download will work.
In detail:
-c forces youtube-dl to always resume downloads. By default, youtube-dl does already resume downloads. At best, this option is superfluous. At worst, you may be forcing youtube-dl to resume a download in another quality, which will result in a broken video file.
-i makes youtube-dl continue if it cannot download a video from the playlist. Unlike the other options, it is regularly useful. Be aware that you may miss errors though, if you need a complete download.
-t is the equivalent of -o "%(title)s-%(id)s.%(ext)s". As such, it is causing the immediate error at hand, since you are passing in two different output templates and youtube-dl doesn't know which one to pick.
-w forces youtube-dl to never overwrite an existing file. This is useful for metadata files, which you don't use in the first place. Even then, most users will want the updated information.

Unable to add silence to end of mp3 using cat

I have a mp3 file with silence, s.mp3, which I'm trying to add to the end of an mp3 using:
cat file1.mp3 s.mp3 > file1.mp3
This worked fine for some mp3 files I downloaded from the net but not the files I created myself using lame.
I'm on mac os x.
Since I'm making the mp3 files myself with lame maybe I can do something that will allow then to work with cat.
How might I establish the problem?
Most file formats are too complicated for concatenation to work. If you know how to program, look at a class called AVAsset in the Mac OS X SDK documentation. If you do not want to program, you can probably find an App that concatenates audio files together.
(Although, to my surprise I do see a "MacHint" that claims that you can cat mp3s together).
Also, see https://superuser.com/questions/78912/free-mp3-merge-for-mac-os-x

How to stream all videos in a folder?

Hi i want to stream videos over web using ffserver. i got this link as reference.
Now what i am not able to figure out is how to pass a folder(which content all videos i want to stream) as input to stream all videos. I also want add more videos dynamically to this folder in time to time and streaming should happen(like how it works in Darwin). now i can't use Darwin because it doesn't support for iOS.
please give me a suggestion.
is there any other open source tool by which i can do this?
I wrote a bash script for this, it's working in ubuntu 16
Hopefully someone else can write it up in a less terrible language
Here's the script:
echo -e "HTTPPort 8090\nHTTPBindAddress 0.0.0.0\nMaxHTTPConnections 2000\nMaxClients 1000\nMaxBandwidth 1000\nCustomLog -\n<Stream stat.html>\nFormat status\n</Stream>"
num=1
for i in *.mp3; do
echo -e "<Stream \"$(urlencode $i)\">\nFile \"$(pwd)/$i\"\nFormat mp2\nAudioCodec libmp3lame\nAudioBitRate 64\nAudioChannels 1\nAudioSampleRate 44100\nNoVideo\n</Stream>"
done
save this as a bash script in the folder you want to serve, I'll refer to it as:
./gen_ffserver_conf.sh
it's hard coded for mp3, you'd have to sort through my echos to get it to do another format.
run the server with:
ffserver -f <(bash -e ./gen_ffserver_conf.sh)
I had to install a package for the url encoding:
sudo apt install gridsite-clients
(and of course you need ffserver as well, in the ffmpeg package)
I stream the files by going to:
http://<ip address of streaming server>:8090/stat.html
and clicking on the urlencoded values, (using chromium). This will open the stream and start playing.
Explanation:
ffserver doesn't like wildcards, or at least I never figured that out, so I'm just creating an entry for each file in the server. The urlencoding is annoying but necessary for the stat page links to work properly.

How to know active audio device for sox in windows

I'm trying to stream sound from my soundcard using sox's default audio device and dump it as a raw file. Unfortunately no sound is being detected.
Sox always use this as input and I think it's for linux.(correct me if i'm wrong but it doesn't really emit any sound in windows)
'/dev/dsp' (ossdsp)
In WinXP, I downloaded SoX 14.3.0 from here, and from a command prompt I can do:
sox -d recfile.wav
which records from the soundcard. Where do you see SoX trying to use /dev/dsp?
sox -d -t wav - | lame - o.mp3
Just make sure the default audio in is wave out mix which can be set in sounds control panel.

Resources