Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 15 Aug 2018, 13:24
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars ) » Pour les francophones
Aide pour un script [résolu]
Moderators: Béèm, darkerror05
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
patrick21

Joined: 09 Aug 2014
Posts: 38

PostPosted: Tue 31 Jul 2018, 00:17    Post subject:  Aide pour un script [résolu]  

Bonjour,

j'aurais besoin d'aide pour un script.

J'utilise Soundstretch en ligne de commande pour manipuler des fichiers wav.

Pour un seul fichier, ça va. Par ex pour baisser de 3 demi-tons:

Code:
soundstretch input.wav output.wav -pitch=-3


Mais j'aimerais faire ça pour plusieurs fichiers en même temps. J'aissayé:

Code:
#!/bin/bash
pitch=-3
for f in *.wav; do
    fname=$(basename $f)
    ext="${fname##*.}"
    base="${fname%.*}"
    ./soundstretch $f $base$pitch.$ext -pitch=$pitch
done

Sans succès. Quelqu'un aurait-il une idée. Merci

La page de soundstrecht
https://www.surina.net/soundtouch/soundstretch.html

Last edited by patrick21 on Tue 31 Jul 2018, 05:22; edited 1 time in total
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3341
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 31 Jul 2018, 03:57    Post subject:  

Bonjour,
Ne manque-t-il pas le chemin complet du dossier contenant les fichiers wav?
Code:
for f in /chemin/vers/dossier/*.wav; do


Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
patrick21

Joined: 09 Aug 2014
Posts: 38

PostPosted: Tue 31 Jul 2018, 04:02    Post subject:  

merci de ta réponse.

Le script est dans le dossier où sont les fichiers. Mais peut-être que cela ne suffit pas. Je vais essayer.
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3341
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 31 Jul 2018, 04:15    Post subject:  

Code:
for f in ./*.wav; do
Question
_________________

Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 3341
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 31 Jul 2018, 04:29    Post subject:  

Autrement, va dans la rubrique "Programming" de la partie anglophone, tu trouveras sans doute quelqu'un qui se fera un plaisir de te dépanner, ou encore sur le forum Ubuntu, où j'ai pour ma part trouvé pratiquement toutes les réponses à mes "problèmes". Wink

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1573
Location: Japan

PostPosted: Tue 31 Jul 2018, 04:53    Post subject: Re: Aide pour un script  

patrick21 wrote:

Code:
#!/bin/bash
pitch=-3
for f in *.wav; do
    fname=$(basename $f)
    ext="${fname##*.}"
    base="${fname%.*}"
    ./soundstretch $f $base$pitch.$ext -pitch=$pitch
done


First you need to change to the working directory (= directory of script and wav files)
This should work:
Code:
cd "${0%/*}"
for f in *.wav; do

P.S. I google translated this page. French is all Greek to me Laughing
Back to top
View user's profile Send private message 
patrick21

Joined: 09 Aug 2014
Posts: 38

PostPosted: Tue 31 Jul 2018, 05:17    Post subject:  

Bonjour,

j'ai trouvé ce qui buggait. En fait, il faut certainement indiquer le chemin du fichier, mais surtout le ./ avant soundstretch n'a pas l'air correct.

J'ai changé le script de:
Code:

#!/bin/bash
pitch=-3
for f in *.wav; do
    fname=$(basename $f)
    ext="${fname##*.}"
    base="${fname%.*}"
    ./soundstretch $f $base$pitch.$ext -pitch=$pitch
done


vers

Code:
#!/bin/bash
pitch=-3
cd /root/test
for f in *.wav; do
    fname=$(basename $f)
    ext="${fname##*.}"
    base="${fname%.*}"
    soundstretch $f $base$pitch.$ext -pitch=$pitch
done


et cela a fonctionné. En tout cas, merci beaucoup pour votre aide.

MochiMoppel, I modified the script and added the workin directory (not with your writing, because I did not understand it), and I remove the ./ before soudstrecht wihich seems to be for windows. I dont know if it is properly made, but it works.

Thank you!
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1573
Location: Japan

PostPosted: Tue 31 Jul 2018, 09:27    Post subject:  

patrick21 wrote:
I remove the ./ before soudstrecht wihich seems to be for windows

Bonjour and congratulations!

./ before soundstretch is not only for WIndows. Since you used it in your code I assumed that you did this on purpose. You must use this syntax if the file soundstretch is located in the directory of the script and the *.wav files. If you saved soundstretch into one of the directories where bash searches for executable files, e.g. /usr/bin , then this syntax will not work.
Back to top
View user's profile Send private message 
patrick21

Joined: 09 Aug 2014
Posts: 38

PostPosted: Tue 31 Jul 2018, 14:08    Post subject:  

Thanks for the explanation. I did not use this syntax really on purpose, I just copied a script. But I understand that, in my case, the ./ was not necessary.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars ) » Pour les francophones
Jump to:  

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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1342s ][ Queries: 11 (0.0297s) ][ GZIP on ]