audio device selection prompt for pyaudio recorder and update to usage notes

main
Rob Canning 2024-01-30 21:32:07 +01:00
parent ed3c45afda
commit 788e0ce382
3 changed files with 52 additions and 53 deletions

View File

@ -1,8 +1,11 @@
# uho! # uho!
Some python magick to help making the Uho podcast. https://uho.rizom,si Some python magick to help with making the Uho podcast. https://uho.rizom,si
## usage examples: ## Usage examples:
## create a database of all music files
./mk_music_library_db.py --music_directory=music --database=database/uho.db
### create a new playlist ### create a new playlist
./mk_show.py --episode 2 --date 2024-03-11 --playlist new ./mk_show.py --episode 2 --date 2024-03-11 --playlist new
@ -15,19 +18,36 @@ when happy with the playlist then record the voice fills:
### record the voice fills for between the songs ### record the voice fills for between the songs
each song should have a short intro description and a longer outro description each song should have a short intro description and a longer outro description
### record the intros for track 2 ### record the intros for episode 1 on audio device 6
./recorder.py -e 2 -f in ./recorder.py --episode 1 --sound_card 6 --fills out
### record the outros for track 2 ### record the outros for episode 1 on audio device 0
./recorder.py -e 2 -f out ./recorder.py -e 1 -s 0 -f out
now you have the voice fills and the playlist - time to cook up the show... now you have the voice fills and the playlist - time to cook up the show...
### keep the playlist and generate a website artwork and an audiofile output ### keep the playlist and generate a website artwork and an audiofile output
./mk_show.py --episode 0 --date 2024-1-30 --playlist keep --mp3 --web --art ./mk_show.py --episode 0 --date 2024-1-30 --playlist keep --mp3 --web --art
## unziping bandcamp into their own directory
for i in *.zip; do b=`basename "$i" .zip`; echo unzip \"$i\" -d \"$b\" ; done
featured labels and artists:
## install notes
now using a venv so :
python3 -m venv .venv
source .venv/bin/activate
pip install tinytag scikit-image popen
sudo apt install portaudio mp3info
pip install pyaudio playsound pynput
## featured labels and artists:
https://pharmafabrik.bandcamp.com/ https://pharmafabrik.bandcamp.com/
https://kamizdat.bandcamp.com/ https://kamizdat.bandcamp.com/
https://sploh.bandcamp.com/ https://sploh.bandcamp.com/
@ -43,30 +63,5 @@ https://moonleerecords.bandcamp.com/
https://sirom.bandcamp.com/music https://sirom.bandcamp.com/music
https://kikiriki.bandcamp.com https://kikiriki.bandcamp.com
##
unziping bandcamp
for i in *.zip; do b=`basename "$i" .zip`; echo unzip \"$i\" -d \"$b\" ; done
## install notes
now using a venv so :
python3 -m venv .venv
source .venv/bin/activate
pip install tinytag scikit-image popen
sudo apt install portaudio mp3info
pip install pyaudio playsound pynput
recorder?
## run the script
// fresh start
echo "" > playlists/track_playout_history.txt; rm show.db ; mk_master_playlist.sh; ./mk_show.py 2 2024-04-17;
// generate podcast episode 3 with a release date of 2024-02-23
/mk_show.py 3 2024-02-23

View File

@ -16,7 +16,6 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/mediaelementplayer.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mediaelement@4.2.7/build/mediaelementplayer.min.css">
<link rel="stylesheet" href="../../css/aos.css"> <link rel="stylesheet" href="../../css/aos.css">
<link rel="stylesheet" href="../../css/style.css"> <link rel="stylesheet" href="../../css/style.css">

View File

@ -24,17 +24,6 @@ from glob import glob
import tkinter as tk import tkinter as tk
from tkinter import filedialog as fd from tkinter import filedialog as fd
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-d", "--date", help="Show Date") parser.add_argument("-d", "--date", help="Show Date")
parser.add_argument("-e", "--episode", help="Episode Number", type=int) parser.add_argument("-e", "--episode", help="Episode Number", type=int)
@ -44,9 +33,29 @@ parser.add_argument("-w", "--web", action="store_true")
parser.add_argument("-a", "--art", action="store_true") parser.add_argument("-a", "--art", action="store_true")
parser.add_argument("-i", "--insert_fills", action="store_true") parser.add_argument("-i", "--insert_fills", action="store_true")
parser.add_argument("-f", "--fill", help="fill type", type=str) parser.add_argument("-f", "--fill", help="fill type", type=str)
parser.add_argument("-s", "--sound_card", help="audio device", type=int)
args = parser.parse_args() args = parser.parse_args()
# list available audio devices
p = pyaudio.PyAudio()
info = p.get_host_api_info_by_index(0)
numdevices = info.get('deviceCount')
for i in range(0, numdevices):
if (p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0:
print("Input Device id ", i, " - ", p.get_device_info_by_host_api_device_index(0, i).get('name'))
if args.sound_card == False:
audio_device_number = input('''
-------------------------------------------------------------
what audio device do you choose:
-------------------------------------------------------------
''')
else:
audio_device_number = args.sound_card
path = pathlib.Path.cwd() path = pathlib.Path.cwd()
show_name = "UhO" show_name = "UhO"
@ -55,17 +64,12 @@ show_rss = "podcast_rss.xml"
show_email = "uho.podcast@gmail.com" show_email = "uho.podcast@gmail.com"
episode_author="Rob Canning" episode_author="Rob Canning"
show_short_description = '''The UhO! podcast presents an eclectic selection of independent music from Slovenia. The show aims to deliver as broad a range of genres as possible; banging techno, sludge, math rock, contemporary classical, doom, free improvisation, noise music, glitch, jazz skronk, field recordings, ambient, drone....etc etc... whatever the genre, you can be sure you are listening to the latest and most inovative music on offer in this part of the world. Hosted and compiled by Rob Canning, the show is published weekly by Zavod Rizoma and is broadcast in Slovenia on FM by mariborski radio študent: MARŠ. It as also available as a podcast. Use our RSS feed or search for UhO Podcast where ever you subscribe to podcasts'''
episode_number = args.episode episode_number = args.episode
fill = args.fill; fill = args.fill;
input_date = args.date input_date = args.date
episode_date = datetime.datetime.now().strftime("%Y-%m-%d") episode_date = datetime.datetime.now().strftime("%Y-%m-%d")
episode_duration = 10 episode_duration = 10
show_cover = ""
archive = [] archive = []
#artists_played = []
artist_abreviated = []
# sqlite database connection # sqlite database connection
conn = sqlite3.connect("database/show.db") conn = sqlite3.connect("database/show.db")
@ -79,6 +83,7 @@ if not os.path.exists(fill_path):
#TODO GET VARIATION PROMPT #TODO GET VARIATION PROMPT
def get_playlist_for_fill_recording(conn, episode_number, episode_duration): def get_playlist_for_fill_recording(conn, episode_number, episode_duration):
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute('SELECT * FROM EPISODES WHERE EPISODE=? ORDER BY track_number ASC', [episode_number]) cursor.execute('SELECT * FROM EPISODES WHERE EPISODE=? ORDER BY track_number ASC', [episode_number])
preview = cursor.fetchall() preview = cursor.fetchall()
@ -99,10 +104,10 @@ def get_playlist_for_fill_recording(conn, episode_number, episode_duration):
print(">> SELECT AN OPTION: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") print(">> SELECT AN OPTION: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
user_input = input(''' user_input = input('''
(l)isten to track [l]isten to track
R ECORD FILL [r]ecord voice fill
>>>>>>>>>>>>>>>>>>>>>>>>>>> OR PRESS ENTER TO PROCEED................... : ''') >>>>>>>>>>>>>>>>>>>>>>>>>>> OR PRESS ENTER TO PROCEED................... : ''')
if user_input == 'l': if user_input == 'l':
playlist_preview_track(conn, episode_number, episode_duration) playlist_preview_track(conn, episode_number, episode_duration)